#!/usr/bin/node

const log = console.log,
      fs = require('fs'),
      dir = process.argv[2];

try{
  if(fs.statSync(dir).isFile()){
    log('This is a file and cannot be deleted using the delete folder command');
    process.exit(2);
  }
  fs.rmdirSync(dir);
  log('Folder deleted successfully!');
}catch(e){
  console.error(e.message);
  process.exit(1);
}
